package com.caiya.controller;

import com.caiya.cart.Res;
import com.caiya.cart.entity.CartUser;
import com.caiya.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Created by Administrator on 2018/11/22 0022.
 */
@RestController
@RequestMapping("/user")
@Api(description = "用户")
public class CartUserController {

    @Autowired
    private UserService userService;

    /**
     *  此接口的用途
     * @return
     */
    @GetMapping(value = "/list")
    @ApiOperation(value = "获取",notes = "",response = CartUser.class)
    public Res list(){
        Res res = null;
        try {
            List<CartUser> list = userService.list();
            res = new Res(list );
        }catch (Exception e){
            e.printStackTrace();
            res = new Res(Res.CODE_FAIL,e.getMessage());
        }
        return res;
    }


    /**
     *  此接口的用途
     * @return
     */
    @GetMapping(value = "/all")
    @ApiOperation(value = "sss",notes = "ss")
    public Res ss(){
        Res apiResult = null;
        try {

            apiResult = new Res("");
        }catch (Exception e){
            e.printStackTrace();
            apiResult = new Res(Res.CODE_FAIL,e.getMessage());
        }
        return apiResult;
    }

}
